An explanation from the bottom-up
Julien LENORMAND - Kaizen Solutions
Who has heard of it ?
Who knows what it is ?
Who could explain ?
on the Kaizen Solutions blog:
French: “une introduction à l’architecture héxagonale” by Xavier BOUVARD
Quizz on the pre-requisites :
so much jargon …
Who is a developer ? We want code !
starting from a concrete et real use-case/problem
mostly code, that we will comment together
keep the “big concepts” for the end of the talk (wrap-up)
Follow the progress of the Pull requests and their reviews by several people in the same team working on mciro-services.
Quick prototyping in Python :
v1
import stashy # library for BitBucket
login = "Julien"
token = "AbCdEf01#"
server_url = "https://bitbucket.internal.corp:1234"
project_name = "AwesomeProject" # containing several repositories
stash = stashy.connect(server_url, login, token)
for repo_data in stash.projects[project_name].repos.list():
repo_slug = repo_data["slug"] # identifier
print("Repo " + repo_slug)
for pr_data in (stash.projects[project_name]
.repos[repo_slug].pull_requests.list()):
title = pr_data["title"]
author_name = pr_data["author"]["displayName"]
print(f" - PR {title!r} de {author_name!s}")
for reviewer_data in pr_data["reviewers"]:
reviewer_name = reviewer_data["user"]["displayName"]
has_approved = bool(reviewer_data["approved"])
print(f" - {'OK' if has_approved else ' '} {reviewer_name}")
Repo AlpesDHuez
- PR "add foo to bar" by Elena
- OK Gabin
- Julien
- PR "remove qux from tez" by Julien
- OK Gabin
Repo Bonneval
Repo Chamrousse
- PR "increase pol to 4000" by Julien
- Elena
- Gabin
Repo GrandBornand
Repo Meribel
- PR "doc for lud" by Elena
- OK Agathe
We can do clearer : explaining what actions are available !
v2
my_id = "123456"
pr_author_id = pull_request_data["author"]["id"]
i_am_reviewer = my_id in (reviewer_data["user"]["id"]
for reviewer_data in pull_request_data["reviewers"])
if my_id == pr_author_id:
print(f"Repo {repo_slug!s} PR {pr_title!r}")
# display the list of persons that have NOT approved, or PRs that are ready to be merged
reviewers_data_not_approved = tuple(reviewer_data
for reviewer_data in pull_request_data["reviewers"]
if not reviewer_data["approved"])
if len(reviewers_data_not_approved) == 0:
print(" -> to merge")
else:
print("\n".join(" -> contact " + reviewer_data["user"]["displayName"]
for reviewer_data in reviewers_data_not_approved))
elif i_am_reviewer:
print(f"Repo {repo_slug!s} PR {pr_title!r} by {pr_author_display_name!s}")
print(" -> to review")
Repo AlpesDHuez PR "add foo to bar" de Elena
-> to review
Repo AlpesDHuez PR "remove qux from tez"
-> to merge
Repo Chamrousse PR "increase pol to 4000"
-> contact Elena
-> contact Gabin
LGTM
I add :